#include <stdio.h>  
int arr[105][105];  
  
int x[4] = {1, 0, -1, 0};  
  
int y[4] = {0, -1, 0, 1};  
  
int main() {  
    int n, cnt = 1, i = 0, nowx = 0, nowy = 1;  
    if (scanf("%d", &n));  
    while (cnt <= n * n) {  
        if (nowx + x[i] <= n && nowx + x[i] > 0 && nowy + y[i] <= n  
                && nowy + y[i] > 0) {  
            if (arr[nowx + x[i]][nowy + y[i]])  
                goto bk;  
            nowx += x[i];  
            nowy += y[i];  
            arr[nowx][nowy] = cnt++;  
        } else {  
bk:  
            ;  
            i++;  
            i %= 4;  
        }  
    }  
    for (int i = 1; i <= n; i++) {  
        for (int j = 1; j <= n; j++) {  
            printf("%3d", arr[j][i]);  
        }  
        printf("\n");  
    }  
    return 0;  
}  